<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .waterfall {
        column-count: 3; /* 设置列数为3 */
        column-gap: 20px; /* 设置列之间的间隔为20像素 */
      }

      .item {
        width: 100%; /* 设置每个元素的宽度为100% */
        margin-bottom: 20px; /* 设置每个元素的下边距为20像素 */
        break-inside: avoid; /* 防止元素被列中断 */
      }
    </style>
  </head>
  <body>
    <div class="waterfall">
      <div class="item">1</div>
      <div class="item">2</div>
      <div class="item">3</div>
      <div class="item">4</div>
      <div class="item">5</div>
      <div class="item">6</div>
      <div class="item">7</div>
      <div class="item">8</div>
      <div class="item">9</div>
      <div class="item">10</div>
    </div>
  </body>
</html>
